﻿<Window x:Class="BookReader.Dialogs.GotoPageWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ucd="clr-namespace:BookReader.Dialogs"
    Title="Goto" Height="300" Width="860"
    mc:Ignorable="d" ResizeMode="CanResizeWithGrip">
	<Window.Resources>
		<DataTemplate x:Key="GotoPageTemplate">
			<Grid d:DesignWidth="130" d:DesignHeight="180">
				<Grid.RowDefinitions>
					<RowDefinition Height="*"/>
					<RowDefinition Height="Auto"/>
				</Grid.RowDefinitions>
				<StackPanel Margin="0">
				<StackPanel.Background>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="Black" Offset="0"/>
						<GradientStop Color="White" Offset="1"/>
						<GradientStop Color="#FF353535" Offset="0.235"/>
						<GradientStop Color="#FF3E3E3E"/>
					</LinearGradientBrush>
				</StackPanel.Background>

				<Border BorderBrush="Black" BorderThickness="1" Width="70">
					<Image x:Name="ImgPageSource" Source="{Binding Image}"
                           Stretch="Fill"/>
				</Border>
				<Border BorderBrush="Black" BorderThickness="1" Width="70" RenderTransformOrigin="0.5,0.5" Height="55" Margin="17.5,0,42.5,0">
					<Border.RenderTransform>
						<TransformGroup>
							<ScaleTransform ScaleX="1" ScaleY="-1"/>
							<SkewTransform AngleX="-26.032" AngleY="0"/>
						</TransformGroup>
					</Border.RenderTransform>
					<Border.OpacityMask>
						<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
							<GradientStop Color="Transparent" Offset="0.087"/>
							<GradientStop Color="White" Offset="1"/>
							<GradientStop Color="#72FEFEFE" Offset="0.643"/>
						</LinearGradientBrush>
					</Border.OpacityMask>
				<Image x:Name="ImgPageSourceReflect" Source="{Binding Image}" 
				Stretch="Fill" />
				</Border>
				</StackPanel>
				<Label Margin="3" Content="{Binding Index}" Grid.Row="1"
                       HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"/>
			</Grid>
		</DataTemplate>

        <Style TargetType="ListBox">
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <WrapPanel/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
        </Style>
    </Window.Resources>
	
        <ListBox Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10"
                 x:Name="lbPages" ItemsSource="{Binding Pages}"
                 VirtualizingStackPanel.IsVirtualizing="True"
                 ItemTemplate="{DynamicResource GotoPageTemplate}"
                 MouseDoubleClick="lbPages_MouseDoubleClick">
        </ListBox>
    
</Window>
